~ chicken-core (master) /manual/Module (scheme char)
Trap1[[tags: manual]]
2[[toc:]]
3
4== Module (scheme char)
5
6R7RS Operations on characters.
7
8<procedure>(char-ci=? char[1] char[2] char[3] ...)</procedure><br>
9<procedure>(char-ci>? char[1] char[2] char[3] ...)</procedure><br>
10<procedure>(char-ci<? char[1] char[2] char[3] ...)</procedure><br>
11<procedure>(char-ci>=? char[1] char[2] char[3] ...)</procedure><br>
12<procedure>(char-ci<=? char[1] char[2] char[3] ...)</procedure><br>
13
14These procedures are similar to char=? et cetera, but they treat upper case
15and lower case letters as the same. For example, {{(char-ci=? #\A #\a)}} returns
16#t.
17
18Specifically, these procedures behave as if char-foldcase were applied to their
19arguments before they were compared.
20
21<procedure>(char-alphabetic? char)</procedure><br>
22<procedure>(char-numeric? char)</procedure><br>
23<procedure>(char-whitespace? char)</procedure><br>
24<procedure>(char-upper-case? letter)</procedure><br>
25<procedure>(char-lower-case? letter)</procedure><br>
26
27These procedures return #t if their arguments are alphabetic, numeric,
28whitespace, upper case, or lower case characters, respectively, otherwise they
29return #f. Specifically, they must return #t when applied to characters with
30the Unicode properties Alphabetic, Numeric_Type=Decimal, White_Space,
31Uppercase, and Lowercase respectively, and #f when applied to any other Unicode
32characters. Note that many Unicode characters are alphabetic but neither upper
33nor lower case.
34
35<procedure>(digit-value char)</procedure>
36
37This procedure returns the numeric value (0 to 9) of its argument if it is a
38numeric digit (that is, if char-numeric? returns #t), or #f on any other
39character.
40
41 (digit-value #\3) ==> 3
42 (digit-value #\x0664) ==> 4
43 (digit-value #\x0AE6) ==> 0
44 (digit-value #\x0EA6) ==> #f
45
46<procedure>(char-upcase char)</procedure><br>
47<procedure>(char-downcase char)</procedure><br>
48<procedure>(char-foldcase char)</procedure><br>
49
50The char-upcase procedure, given an argument that is the lowercase part of a
51Unicode casing pair, returns the uppercase member of the pair. Note that
52language-sensitive casing pairs are not used. If the argument is not the
53lowercase member of such a pair, it is returned.
54
55The char-downcase procedure, given an argument that is the uppercase part of a
56Unicode casing pair, returns the lowercase member of the pair. Note that
57language-sensitive casing pairs are not used. If the argument is not the
58uppercase member of such a pair, it is returned.
59
60The char-foldcase procedure applies the Unicode simple case-folding algorithm
61to its argument and returns the result. Note that language-sensitive folding is
62not used. If the character that results from folding is not supported by the
63implementation, the argument is returned. See UAX #44 (part of the Unicode
64Standard) for details.
65
66Note that many Unicode lowercase characters do not have uppercase equivalents.
67
68<procedure>(string-ci=? string[1] string[2] string[3] ...)</procedure><br>
69<procedure>(string-ci<? string[1] string[2] string[3] ...)</procedure><br>
70<procedure>(string-ci>? string[1] string[2] string[3] ...)</procedure><br>
71<procedure>(string-ci<=? string[1] string[2] string[3] ...)</procedure><br>
72<procedure>(string-ci>=? string[1] string[2] string[3] ...)</procedure><br>
73
74The "-ci" procedures behave as if they applied string-foldcase to their
75arguments before invoking the corresponding procedures without “-ci”.
76
77<procedure>(string-upcase string)</procedure><br>
78<procedure>(string-downcase string)</procedure><br>
79<procedure>(string-foldcase string)</procedure><br>
80
81These procedures apply the Unicode full string uppercasing, lowercasing, and
82case-folding algorithms to their arguments and return the result. In certain
83cases, the result differs in length from the argument. If the result is equal
84to the argument in the sense of string=?, the argument may be returned. Note
85that language-sensitive mappings and foldings are not used. The Unicode
86Standard prescribes special treatment of the Greek letter Σ, whose normal
87lower-case form is σ but which becomes ς at the end of a word. See UAX #44
88(part of the Unicode Standard) for details. However, implementations of
89string-downcase are not required to provide this behavior, and may choose to
90change Σ to σ in all cases.
91
92---
93Previous: [[Module (scheme case-lambda)]]
94
95Next: [[Module (scheme complex)]]